package com.koron.common.core.business.weather.bean;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
/**
 * {
 *     "code": "200",
 *     "updateTime": "2022-05-29T14:52+08:00",
 *     "fxLink": "http://hfx.link/2bc1",
 *     "now": {
 *         "obsTime": "2022-05-29T14:46+08:00",
 *         "temp": "23",
 *         "feelsLike": "25",
 *         "icon": "104",
 *         "text": "阴",
 *         "wind360": "315",
 *         "windDir": "西北风",
 *         "windScale": "2",
 *         "windSpeed": "10",
 *         "humidity": "98",
 *         "precip": "0.0",
 *         "pressure": "1001",
 *         "vis": "30",
 *         "cloud": "91",
 *         "dew": "21"
 *     },
 *     "refer": {
 *         "sources": [
 *             "QWeather",
 *             "NMC",
 *             "ECMWF"
 *         ],
 *         "license": ["no commercial use"]
 *     }
 * }
 */

@NoArgsConstructor
@Data
public class QWeatherDto {

    @ApiModelProperty("API状态码，具体含义请参考状态码 和风天气")
    @JSONField(name = "code")
    private String code;

    @ApiModelProperty("当前API的最近更新时间")
    @JSONField(name = "updateTime")
    private String updateTime;

    @ApiModelProperty("当前数据的响应式页面，便于嵌入网站或应用")
    @JSONField(name = "fxLink")
    private String fxLink;

    @ApiModelProperty("当前API的最近更新时间")
    @JSONField(name = "now")
    private NowDTO now;

    @ApiModelProperty("当前API的最近更新时间")
    @JSONField(name = "refer")
    private ReferDTO refer;

    @NoArgsConstructor
    @Data
    public static class NowDTO {

        @javax.persistence.Transient
        @ApiModelProperty("地区名称")
        private String cityStr;

        @ApiModelProperty("数据观测时间")
        @JSONField(name = "obsTime")
        private String obsTime;

        @ApiModelProperty("温度，默认单位：摄氏度")
        @JSONField(name = "temp")
        private String temp;

        @ApiModelProperty("体感温度，默认单位：摄氏度")
        @JSONField(name = "feelsLike")
        private String feelsLike;

        @ApiModelProperty("天气状况和图标的代码，图标可通过天气状况和图标下载")
        @JSONField(name = "icon")
        private String icon;

        @ApiModelProperty("天气状况的文字描述，包括阴晴雨雪等天气状态的描述")
        @JSONField(name = "text")
        private String text;

        @ApiModelProperty("风向360角度")
        @JSONField(name = "wind360")
        private String wind360;

        @ApiModelProperty("风向")
        @JSONField(name = "windDir")
        private String windDir;

        @ApiModelProperty("风力等级")
        @JSONField(name = "windScale")
        private String windScale;

        @ApiModelProperty("风速，公里/小时")
        @JSONField(name = "windSpeed")
        private String windSpeed;

        @ApiModelProperty("相对湿度，百分比数值")
        @JSONField(name = "humidity")
        private String humidity;

        @ApiModelProperty("当前小时累计降水量，默认单位：毫米")
        @JSONField(name = "precip")
        private String precip;

        @ApiModelProperty("大气压强，默认单位：百帕")
        @JSONField(name = "pressure")
        private String pressure;

        @ApiModelProperty("能见度，默认单位：公里")
        @JSONField(name = "vis")
        private String vis;

        @ApiModelProperty("云量，百分比数值。可能为空")
        @JSONField(name = "cloud")
        private String cloud;

        @ApiModelProperty("露点温度。可能为空")
        @JSONField(name = "dew")
        private String dew;
    }

    @NoArgsConstructor
    @Data
    public static class ReferDTO {

        @ApiModelProperty("原始数据来源，或数据源说明，可能为空")
        @JSONField(name = "sources")
        private List<String> sources;

        @ApiModelProperty("数据许可或版权声明，可能为空")
        @JSONField(name = "license")
        private List<String> license;
    }
}